///*
// *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
// *
// *  Redistribution and use in source and binary forms, with or without
// *  modification, are permitted provided that the following conditions are met:
// *
// *  Redistributions of source code must retain the above copyright notice,
// *  this list of conditions and the following disclaimer.
// *  Redistributions in binary form must reproduce the above copyright
// *  notice, this list of conditions and the following disclaimer in the
// *  documentation and/or other materials provided with the distribution.
// *  Neither the name of the dreamlu.net developer nor the names of its
// *  contributors may be used to endorse or promote products derived from
// *  this software without specific prior written permission.
// *  Author: Chill 庄骞 (smallchill@163.com)
// */
//package com.plian.system.service.fr.vehicle.impl;
//
//import com.alibaba.excel.EasyExcel;
//import com.alibaba.excel.read.listener.PageReadListener;
//import com.alibaba.fastjson.JSON;
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
//import com.baomidou.mybatisplus.core.toolkit.Wrappers;
//import com.fasterxml.jackson.databind.ObjectMapper;
//import com.plian.Tools.*;
//import com.plian.Tools.office.WordUtil;
//import com.plian.Tools.pagedata.PageData;
//import com.plian.system.bean.fr.VehicleInfoExcelBean;
//import com.plian.system.cache.UserCache;
//import com.plian.system.config.exception.MyRuntimeException;
//import com.plian.system.constant.sys.FormStatusConstant;
//import com.plian.system.constant.sys.FormTypeConstant;
//import com.plian.system.constant.yth.YthConstant;
//import com.plian.system.dao.sys.file.FileDao;
//import com.plian.system.dao.sys.orgzation.OrgzationDao;
//import com.plian.system.dto.fr.indicators.IndicatorsValueDTO;
//import com.plian.system.dto.fr.vehicle.VehicleInfoDTO;
//import com.plian.system.entity.fr.vehicle.VehicleInfo;
//import com.plian.system.entity.pm.property.PropertyBasics;
//import com.plian.system.entity.sys.ApprovalMessage;
//import com.plian.system.entity.sys.FormHistoryRecord;
//import com.plian.system.entity.sys.Org;
//import com.plian.system.enumeratea.CarInfoStatus;
//import com.plian.system.enumeratea.CarStatus;
//import com.plian.system.excel.ImportExcelUtil;
//import com.plian.system.mapper.fr.indicators.IndicatorsValueMapper;
//import com.plian.system.mapper.fr.vehicle.VehicleInfoMapper;
//import com.plian.system.model.ObjResult;
//import com.plian.system.mybatis.base.BaseFlowService;
//import com.plian.system.mybatis.base.BaseServiceImpl;
//import com.plian.system.mybatis.support.Condition;
//import com.plian.system.properties.GzwProperties;
//import com.plian.system.service.fr.vehicle.IVehicleInfoService;
//import com.plian.system.service.pm.property.IPropertyBasicsService;
//import com.plian.system.service.sys.code.IFormCodeService;
//import com.plian.system.service.sys.file.FileService;
//import com.plian.system.service.sys.message.IApprovalMessageService;
//import com.plian.system.service.sys.orgzation.IOrgService;
//import com.plian.system.service.sys.system.IFormHistoryRecordService;
//import com.plian.system.service.wf.FormWorkflowService;
//import com.plian.system.vo.fr.indicatorsValue.IndicatorsValueVO;
//import com.plian.system.vo.fr.vehicle.VehicleInfoVO;
//import com.plian.system.vo.report.HeaderVO;
//import com.plian.system.vo.report.ReportReturnVO;
//import com.plian.system.vo.report.ReportVO;
//import com.plian.system.vo.yth.YthResult;
//import com.plian.system.wrapper.fr.veihicle.VehicleInfoWrapper;
//import lombok.AllArgsConstructor;
//import org.apache.commons.io.IOUtils;
//import org.apache.commons.lang.exception.ExceptionUtils;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.core.env.Environment;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//import org.springframework.web.multipart.MultipartFile;
//
//import javax.servlet.http.HttpServletResponse;
//import java.io.*;
//import java.math.BigDecimal;
//import java.util.*;
//import java.util.function.Function;
//import java.util.stream.Collectors;
//import java.util.stream.Stream;
//
//import static com.plian.system.constant.fr.IndicatorsCodeConstant.Y87;
//import static com.plian.system.constant.sys.FormStatusConstant.*;
//import static com.plian.system.constant.sys.FormTypeConstant.FR_VEHICLE_TRANSFER;
//import static com.plian.system.constant.sys.FormTypeConstant.FR_VEHICLE_UPDATE;
//
///**
// * 车辆信息 服务实现类
// *
// * @author jianglei
// * @since 2019-09-26
// */
//@Service
//@AllArgsConstructor
//public class VehicleInfoServiceImpl extends BaseServiceImpl<VehicleInfoMapper, VehicleInfo> implements IVehicleInfoService, BaseFlowService {
//
//
//	private VehicleInfoMapper vehicleInfoMapper;
//
//	private OrgzationDao orgzationDao;
//
//	private VehicleInfoWrapper vehicleInfoWrapper;
//
//	private FileService fileService;
//
//	private FormWorkflowService formWorkflowService;
//
//	private IPropertyBasicsService propertyBasicsService;
//
//	private FileDao fileDao;
//
//	private IFormCodeService formCodeService;
//
//	private GzwProperties gzwProperties;
//
//	private IOrgService orgService;
//
//	private IApprovalMessageService approvalMessageService;
//
//	private IndicatorsValueMapper indicatorsValueMapper;
//
//	private IFormHistoryRecordService formHistoryRecordService;
//
//	private Environment environment;
//
//	private final static String FILE_TYPE = "type";
//
//	private final static String DRIVING_LICENSE_FILE = "drivingLicenseFile";
//
//	private final static String DISPOSAL_FILE = "disposalFile";
//
//	private final static String VEHICLE_FILE = "vehicleFile";
//
//	private final static List<String> noNumberList = Stream.of("015001003","015001004").collect(Collectors.toList());
//
//	@Override
//	@Transactional(rollbackFor=RuntimeException.class)
//    public boolean saveOrUpdate(VehicleInfo vehicleInfo) {
//        if (vehicleInfo.getStatus() == null) {
//			vehicleInfo.setStatus(CarInfoStatus.UNREVIEWED.getStatus());
//        }
//        return super.saveOrUpdate(vehicleInfo);
//    }
//
//    @Override
//    public boolean deleteLogic(List<Long> ids) {
//		for (Long id : ids) {
//			VehicleInfo vehicleInfo = getById(id);
//			if (vehicleInfo == null) {
//				return false;
//			}
//			if (String.valueOf(FR_VEHICLE_UPDATE).equals(vehicleInfo.getFormType())){
//				if (vehicleInfo.getDisposalVehicleId() != null){
//					VehicleInfo disposalVehicle = getById(vehicleInfo.getDisposalVehicleId());
//					if (noNumberList.contains(disposalVehicle.getDisposalMethod())){
//						disposalVehicle.setIsShow(1);
//					}
//					disposalVehicle.setDisposalMethod(null);
//					disposalVehicle.setDisposalPrice(null);
//					disposalVehicle.setDisposalDate(null);
//					disposalVehicle.setCarStatus(CarInfoStatus.USING.getStatus());
//					updateById(disposalVehicle);
//				}
//			}
//			if (String.valueOf(FR_VEHICLE_TRANSFER).equals(vehicleInfo.getFormType())){
//				if (vehicleInfo.getTransferVehicleInfoId() != null){
//					VehicleInfo transferVehicle = getById(vehicleInfo.getTransferVehicleInfoId());
//					transferVehicle.setIsShow(1);
//					transferVehicle.setCarStatus(CarInfoStatus.USING.getStatus());
//					updateById(transferVehicle);
//				}
//			}
//		}
//		return super.deleteLogic(ids);
//    }
//
//	@Override
//	public Boolean deleteLogicByUpdateId(List<Long> ids) {
//		QueryWrapper<VehicleInfo> queryWrapper = new QueryWrapper<>();
//		queryWrapper.in("vehicle_update_id", ids);
//		List<VehicleInfo> vehicleInfos = list(queryWrapper);
//		if (CollectionUtil.isNotEmpty(vehicleInfos)){
//			return deleteLogic(vehicleInfos.stream().map(VehicleInfo::getId).collect(Collectors.toList()));
//		}
//		return true;
//	}
//
//
//    @Override
//	public Map<String, VehicleInfo> getVehicleInfoMap(){
//		Map<String, VehicleInfo> infoMap = new HashMap<>();
//		LambdaQueryWrapper<VehicleInfo> queryWrapper = new LambdaQueryWrapper<>();
//		queryWrapper.ne(VehicleInfo::getStatus,3);
//		List<VehicleInfo> vehicleInfos = list(queryWrapper);
//		if (CollectionUtil.isNotEmpty(vehicleInfos)){
//			infoMap = vehicleInfos.stream().collect(Collectors.toMap(VehicleInfo::getNumberPlate, vehicleInfo -> vehicleInfo, (k1,k2) -> k1));
//		}
//		return infoMap;
//	}
//
//	@Override
//	public Boolean checkIsExisted(List<String> oldNumberPlates, String numberPlate) {
//		if (StringUtil.isNotBlank(numberPlate)) {
//			if (CollectionUtil.isNotEmpty(oldNumberPlates) && oldNumberPlates.contains(numberPlate)){
//				return true;
//			}
//
//			LambdaQueryWrapper<VehicleInfo> queryWrapper = new LambdaQueryWrapper<>();
//			queryWrapper.eq(VehicleInfo::getNumberPlate, numberPlate);
//			queryWrapper.ne(VehicleInfo::getStatus, CarStatus.SCRAP.getStatus());
//			if (Optional.ofNullable(getOne(queryWrapper)).isPresent()) {
//				return false;
//			}
//		}
//
//		return true;
//	}
//
//	@Override
//	public ReportReturnVO stockStatistics(VehicleInfoDTO vehicleInfoDTO) throws Exception{
////		if (Optional.ofNullable(vehicleInfoDTO).isPresent()) {
////
////			/**
////			 * 获取所有下级单位
////			 */
////			if (Optional.ofNullable(vehicleInfoDTO.getCompanyId()).isPresent()){
////				List<String> companyIds = new ArrayList<>();
////				List<PageData> orgs = orgzationService.getChlidList(vehicleInfoDTO.getCompanyId());
////				companyIds.add(vehicleInfoDTO.getCompanyId());
////				if (CollectionUtil.isNotEmpty(orgs)){
////					for (PageData pd : orgs){
////						companyIds.add((String)pd.get("id"));
////					}
////					vehicleInfoDTO.setCompanyIds(companyIds);
////				}
////			}
////
////			/**
////			 * 当年份和当前年份相同时 按默认处理
////			 */
////			if (Optional.ofNullable(vehicleInfoDTO.getYear()).isPresent()) {
////				Calendar instance = Calendar.getInstance();
////				if (instance.get(Calendar.YEAR) == Integer.valueOf(vehicleInfoDTO.getYear())) {
////					vehicleInfoDTO.setYear(null);
////				}
////			}
////		}
//
//		List<VehicleInfo> vehicleInfos = vehicleInfoMapper.stockStatistics(vehicleInfoDTO);
//		List<VehicleInfoVO> data = new ArrayList<>();
//		if (CollectionUtil.isNotEmpty(vehicleInfos)){
//			List<VehicleInfoVO> vehicleInfoVOS = vehicleInfoWrapper.entityToVO(vehicleInfos);
//			List<PageData> allOrgs =  orgzationDao.list(null);
//			Map<String, List<VehicleInfoVO>> map = vehicleInfoVOS.stream().filter(vehicleInfoVO -> StringUtil.isNotBlank(vehicleInfoVO.getCompanyId()))
//					.collect(Collectors.groupingBy(VehicleInfoVO::getCompanyId));
//			int sum = 0;
//			for (PageData org : allOrgs){
//				if (map.containsKey(org.get("id"))){
//					data.addAll(map.get(org.get("id")));
//					sum += map.get(org.get("id")).size();
//					VehicleInfoVO vo = new VehicleInfoVO();
//					vo.setCompanyName("小计：" + map.get(org.get("id")).size());
//					data.add(vo);
//				}
//			}
//			VehicleInfoVO end = new VehicleInfoVO();
//			end.setCompanyName("总计：" + sum);
//			data.add(end);
//		}
//
//		ReportReturnVO reportReturnVO = new ReportReturnVO();
//
//		ReportVO reportVO = new ReportVO();
//
//		reportVO
//			.addHeader(HeaderVO.builder().key("companyName").title("所属单位").build())
//			.addHeader(HeaderVO.builder().key("purchaseCode").title("购置审批编码").build())
//			.addHeader(HeaderVO.builder().key("numberPlate").title("车牌号").build())
//			.addHeader(HeaderVO.builder().key("brand").title("品牌").build())
//			.addHeader(HeaderVO.builder().key("exhaustVolume").title("排气量").build())
//			.addHeader(HeaderVO.builder().key("carModelName").title("车型").build())
//			.addHeader(HeaderVO.builder().key("applicationName").title("用途").build())
//			.addHeader(HeaderVO.builder().key("bareCarPrice").title("裸车单价（万元）").build())
//			.addHeader(HeaderVO.builder().key("purchaseDate").title("购置时间").build())
//			.addHeader(HeaderVO.builder().key("remark").title("备注").build());
//		reportVO.setData(data);
//		reportReturnVO.setGrids(reportVO);
//		return reportReturnVO;
//	}
//
//
//	@Override
//	public boolean updateStatus(List<Long> ids, int status){
//    	if (CollectionUtil.isNotEmpty(ids)){
//			LambdaUpdateWrapper<VehicleInfo> updateWrapper = new LambdaUpdateWrapper<>();
//			updateWrapper.in(VehicleInfo::getId, ids).set(VehicleInfo::getStatus, status);
//			if (status == CarStatus.SCRAP.getStatus()){
//				updateWrapper.set(VehicleInfo::getDef14, DateUtil.now());
//			}
//			return update(updateWrapper);
//		}
//    	return true;
//	}
//
//	@Override
//	public boolean updateStatus(Long id, int status){
//		if (id != null){
//			LambdaUpdateWrapper<VehicleInfo> updateWrapper = new LambdaUpdateWrapper<>();
//			updateWrapper.eq(VehicleInfo::getId, id).set(VehicleInfo::getStatus, status);
//			if (status == CarStatus.SCRAP.getStatus()){
//				updateWrapper.set(VehicleInfo::getDef14, DateUtil.now());
//			}
//			return update(updateWrapper);
//		}
//		return true;
//	}
//
//	@Override
//	public String checkNumber(List<VehicleInfo> vehicleInfos) {
//		List<String> numberList = new ArrayList<>();
//		StringBuilder message = new StringBuilder();
//		for (VehicleInfo vehicleInfo : vehicleInfos){
//			if (CollectionUtil.isNotEmpty(numberList) && numberList.contains(vehicleInfo.getNumberPlate())){
//				message.append(vehicleInfo.getNumberPlate() + "车牌号重复  ");
//			}else {
//				numberList.add(vehicleInfo.getNumberPlate());
//			}
//
//			VehicleInfo old = getOne(new LambdaQueryWrapper<VehicleInfo>().ne(VehicleInfo::getStatus, CarStatus.SCRAP.getStatus())
//					.eq(VehicleInfo::getNumberPlate, vehicleInfo.getNumberPlate()));
//			if (Optional.ofNullable(old).isPresent() && !old.getId().equals(vehicleInfo.getId())){
//				message.append(vehicleInfo.getNumberPlate() + "车牌号已存在  ");
//			}
//
//			old = getOne(new LambdaQueryWrapper<VehicleInfo>().eq(VehicleInfo::getStatus, CarStatus.SCRAP.getStatus())
//					.eq(VehicleInfo::getNumberPlate, vehicleInfo.getNumberPlate()).eq(VehicleInfo::getIsContinueUse, 1));
//			if (Optional.ofNullable(old).isPresent() && !old.getId().equals(vehicleInfo.getId())){
//				message.append(vehicleInfo.getNumberPlate() + "车牌号已淘汰  ");
//			}
//
//		}
//		return message.toString();
//	}
//
//	@Override
//	public void checkNumber(VehicleInfoVO vehicleInfoVO) {
//		if (StringUtil.isBlank(vehicleInfoVO.getNumberPlate())){
//			throw new MyRuntimeException(new ObjResult("车牌号为空!"));
//		}
//		VehicleInfo vehicleInfo = getOne(Wrappers.<VehicleInfo>lambdaQuery()
//				.eq(VehicleInfo::getNumberPlate, vehicleInfoVO.getNumberPlate())
//				.in(VehicleInfo::getCarStatus, Stream.of(CarInfoStatus.UNREVIEWED,CarInfoStatus.AUDIT,CarInfoStatus.USING).collect(Collectors.toList())));
//		if (vehicleInfo != null && !vehicleInfo.getId().equals(vehicleInfoVO.getId())){
//			throw new MyRuntimeException(new ObjResult("车牌号已存在!"));
//		}
//	}
//
//	@Override
//	@Transactional(rollbackFor = RuntimeException.class)
//	public VehicleInfoVO submit(VehicleInfoVO vehicleInfoVO) {
//		if (StringUtil.isBlank(vehicleInfoVO.getFormType())){
//			throw new MyRuntimeException(new ObjResult("单据类型为空!"));
//		}
//
//		VehicleInfo vehicleInfo = vehicleInfoWrapper.voToEntity(vehicleInfoVO);
//		if (!((String.valueOf(FR_VEHICLE_UPDATE).equals(vehicleInfoVO.getFormType()) &&
//				vehicleInfoVO.getDisposalVehicleInfo() != null &&
//				noNumberList.contains(vehicleInfoVO.getDisposalVehicleInfo().getDisposalMethod())))){
//			checkNumber(vehicleInfoVO);
//		}
//		boolean flag = vehicleInfo.getId() == null;
//
//		if (CollectionUtil.isNotEmpty(vehicleInfoVO.getDrivingLicenseFileList())){
//			for (Map map : vehicleInfoVO.getDrivingLicenseFileList()){
//				map.put(FILE_TYPE, DRIVING_LICENSE_FILE);
//			}
//		}
//		if (CollectionUtil.isNotEmpty(vehicleInfoVO.getFileList())){
//			for (Map map : vehicleInfoVO.getFileList()){
//				map.put(FILE_TYPE, VEHICLE_FILE);
//			}
//		}
//		try {
//			PropertyBasics property = propertyBasicsService.findByOrgId(TokenUtil.getTokenOrgId());
//			if (Optional.ofNullable(property).isPresent()){
//				vehicleInfo.setCompanyRankId(property.getOrgGradation());
//			}
//		}catch (Exception e){
//			log.error("根据单位id获取产权信息失败");
//		}
//		vehicleInfo.setStatus(UNREVIEWED);
//		vehicleInfo.setCarStatus(CarInfoStatus.UNREVIEWED.getStatus());
//		VehicleInfo oldInfo = null;
//		if (!flag){
//			oldInfo = getById(vehicleInfo.getId());
//		}
//		if (String.valueOf(FR_VEHICLE_UPDATE).equals(vehicleInfo.getFormType())){
//			//车辆更新
//			if (vehicleInfoVO.getDisposalVehicleInfo() == null){
//				throw new MyRuntimeException(new ObjResult("处置车辆信息为空!"));
//			}
//			VehicleInfo disposalVehicleInfo = getById(vehicleInfoVO.getDisposalVehicleInfo().getId());
//			if (disposalVehicleInfo == null){
//				throw new MyRuntimeException(new ObjResult("处置车辆不存在!"));
//			}
//			if (noNumberList.contains(vehicleInfoVO.getDisposalVehicleInfo().getDisposalMethod())){
//				vehicleInfo.setDisposalVehicleNumberPlate(disposalVehicleInfo.getNumberPlate());
//				vehicleInfo.setCompanyId(disposalVehicleInfo.getCompanyId());
//				vehicleInfo.setCarStatus(CarInfoStatus.IN_DISPOSAL.getStatus());
//				vehicleInfo.setPurchaseDate(disposalVehicleInfo.getPurchaseDate());
//				disposalVehicleInfo.setIsShow(0);
//			}
//			vehicleInfo.setDisposalVehicleId(disposalVehicleInfo.getId());
//			disposalVehicleInfo.setDisposalDate(vehicleInfoVO.getDisposalVehicleInfo().getDisposalDate());
//			disposalVehicleInfo.setDisposalPrice(vehicleInfoVO.getDisposalVehicleInfo().getDisposalPrice());
//			disposalVehicleInfo.setDisposalMethod(vehicleInfoVO.getDisposalVehicleInfo().getDisposalMethod());
//			disposalVehicleInfo.setCarStatus(CarInfoStatus.IN_DISPOSAL.getStatus());
//			saveOrUpdate(disposalVehicleInfo);
//			if (CollectionUtil.isNotEmpty(vehicleInfoVO.getDisposalVehicleInfo().getDisposalFileList())){
//				for (Map map : vehicleInfoVO.getDisposalVehicleInfo().getDisposalFileList()){
//					map.put(FILE_TYPE, DISPOSAL_FILE);
//				}
//			}
//			saveOrUpdate(vehicleInfo);
//			if (flag){
//				fileService.editByType(String.valueOf(disposalVehicleInfo.getId()), vehicleInfoVO.getDisposalVehicleInfo().getDisposalFileList(), DISPOSAL_FILE);
//				fileService.saveAll(String.valueOf(vehicleInfo.getId()), vehicleInfoVO.getDrivingLicenseFileList());
//				fileService.saveAll(String.valueOf(vehicleInfo.getId()), vehicleInfoVO.getFileList());
//			}else {
//				fileService.editByType(String.valueOf(disposalVehicleInfo.getId()), vehicleInfoVO.getDisposalVehicleInfo().getDisposalFileList(), DISPOSAL_FILE);
//				fileService.editByType(String.valueOf(vehicleInfo.getId()), vehicleInfoVO.getDrivingLicenseFileList(), DRIVING_LICENSE_FILE);
//				fileService.editByType(String.valueOf(vehicleInfo.getId()), vehicleInfoVO.getFileList(), VEHICLE_FILE);
//			}
//		}else {
//			saveOrUpdate(vehicleInfo);
//			//车辆新增
//			if (flag){
//				fileService.saveAll(String.valueOf(vehicleInfo.getId()), vehicleInfoVO.getDrivingLicenseFileList());
//				fileService.saveAll(String.valueOf(vehicleInfo.getId()), vehicleInfoVO.getFileList());
//			}else {
//				fileService.editByType(String.valueOf(vehicleInfo.getId()), vehicleInfoVO.getDrivingLicenseFileList(), DRIVING_LICENSE_FILE);
//				fileService.editByType(String.valueOf(vehicleInfo.getId()), vehicleInfoVO.getFileList(), VEHICLE_FILE);
//			}
//		}
//		if (!flag && !vehicleInfo.equals(oldInfo)) {
//			ObjectMapper mapper = new ObjectMapper();
//			try {
//				formHistoryRecordService.submit(FormHistoryRecord.builder().formType(String.valueOf(FormTypeConstant.FR_VEHICLE_INFO))
//						.record(mapper.writeValueAsString(setVO(oldInfo))).recordId(vehicleInfo.getId()).build());
//			} catch (Exception e) {
//				log.error("车辆信息--> 历史数据版本保存失败");
//			}
//		}
//		formWorkflowService.startProcessAndSimulate(String.valueOf(vehicleInfo.getId()), vehicleInfo.getFormType(), new HashMap<>());
//		return vehicleInfoWrapper.entityToVO(vehicleInfo);
//	}
//
//	@Override
//	@Transactional(rollbackFor = RuntimeException.class)
//	public boolean addDisposalInfo(VehicleInfoVO vehicleInfoVO) {
//		VehicleInfo vehicleInfo = getById(vehicleInfoVO.getId());
//		if (vehicleInfo == null){
//			throw new MyRuntimeException(new ObjResult("该车辆不存在!"));
//		}
//		if (CarInfoStatus.PROPOSED_DISPOSAL.getStatus() != vehicleInfo.getCarStatus()){
//			throw new MyRuntimeException(new ObjResult("该车辆不能进行补充信息!"));
//		}
//		vehicleInfo.setDisposalDate(vehicleInfoVO.getDisposalDate());
//		vehicleInfo.setDisposalPrice(vehicleInfoVO.getDisposalPrice());
//		if (CollectionUtil.isNotEmpty(vehicleInfoVO.getDisposalFileList())){
//			for (Map map : vehicleInfoVO.getDisposalFileList()){
//				map.put(FILE_TYPE, DISPOSAL_FILE);
//			}
//		}
//		fileService.editByType(String.valueOf(vehicleInfo.getId()), vehicleInfoVO.getDisposalFileList(), DISPOSAL_FILE);
//		if (CollectionUtil.isNotEmpty(vehicleInfoVO.getDrivingLicenseFileList())
//				&& vehicleInfo.getDisposalDate() != null
//				&& vehicleInfo.getDisposalPrice() != null){
//			vehicleInfo.setCarStatus(CarInfoStatus.DISPOSAL.getStatus());
//			if (vehicleInfoVO.getDisposalFormId() != null){
//				VehicleInfo disposalForm = getById(vehicleInfoVO.getDisposalFormId());
//				if (disposalForm != null){
//					disposalForm.setCarStatus(CarInfoStatus.DISPOSAL.getStatus());
//					saveOrUpdate(disposalForm);
//				}
//			}
//		}
//		return saveOrUpdate(vehicleInfo);
//	}
//
//	@Override
//	public boolean changeInfo(VehicleInfoVO vehicleInfoVO) {
//		VehicleInfo changeInfo = vehicleInfoWrapper.voToEntity(vehicleInfoVO);
//		VehicleInfo vehicleInfo = getById(vehicleInfoVO.getId());
//		if (vehicleInfo == null){
//			throw new MyRuntimeException(new ObjResult("该车辆不存在!"));
//		}
//		if (CarInfoStatus.USING.getStatus() != vehicleInfo.getCarStatus() && FINISH != vehicleInfo.getStatus()){
//			throw new MyRuntimeException(new ObjResult("该车辆不能进行修改信息!"));
//		}
//		if (!vehicleInfo.equals(changeInfo)) {
//			ObjectMapper mapper = new ObjectMapper();
//			try {
//				formHistoryRecordService.submit(FormHistoryRecord.builder().formType(String.valueOf(FormTypeConstant.FR_VEHICLE_INFO))
//						.record(mapper.writeValueAsString(setVO(vehicleInfo))).recordId(vehicleInfo.getId()).build());
//			} catch (Exception e) {
//				log.error("车辆信息--> 历史数据版本保存失败");
//			}
//		}
//
//		vehicleInfo.setBudgetControlIndex(vehicleInfoVO.getBudgetControlIndex());
//		vehicleInfo.setIsChangeBudgetControlIndex(vehicleInfoVO.getIsChangeBudgetControlIndex());
//		vehicleInfo.setCarNumber(vehicleInfoVO.getCarNumber());
////		vehicleInfo.setNumberPlate(vehicleInfoVO.getNumberPlate());
//		vehicleInfo.setBrand(vehicleInfoVO.getBrand());
//		vehicleInfo.setBareCarPrice(vehicleInfoVO.getBareCarPrice());
//		vehicleInfo.setDynamicType(vehicleInfoVO.getDynamicType());
//		vehicleInfo.setPurchaseDate(vehicleInfoVO.getPurchaseDate());
//		vehicleInfo.setCompanyId(vehicleInfoVO.getCompanyId());
//		vehicleInfo.setExhaustVolume(vehicleInfoVO.getExhaustVolume());
//		vehicleInfo.setCarModelId(vehicleInfoVO.getCarModelId());
//		vehicleInfo.setApplicationId(vehicleInfoVO.getApplicationId());
//		vehicleInfo.setRemark(vehicleInfoVO.getRemark());
//		vehicleInfo.setUseReason(vehicleInfoVO.getUseReason());
//		vehicleInfo.setContactPerson(vehicleInfoVO.getContactPerson());
//		vehicleInfo.setTelephone(vehicleInfoVO.getTelephone());
//		vehicleInfo.setDisposalMethod(vehicleInfoVO.getDisposalMethod());
//		vehicleInfo.setDisposalDate(vehicleInfoVO.getDisposalDate());
//		vehicleInfo.setDisposalPrice(vehicleInfoVO.getDisposalPrice());
//		vehicleInfo.setApprovalCode(vehicleInfoVO.getApprovalCode());
//		if (CollectionUtil.isNotEmpty(vehicleInfoVO.getDisposalFileList())){
//			for (Map map : vehicleInfoVO.getDisposalFileList()){
//				map.put(FILE_TYPE, DISPOSAL_FILE);
//			}
//		}
//		if (CollectionUtil.isNotEmpty(vehicleInfoVO.getDrivingLicenseFileList())){
//			for (Map map : vehicleInfoVO.getDrivingLicenseFileList()){
//				map.put(FILE_TYPE, DRIVING_LICENSE_FILE);
//			}
//		}
//		if (CollectionUtil.isNotEmpty(vehicleInfoVO.getFileList())){
//			for (Map map : vehicleInfoVO.getFileList()){
//				map.put(FILE_TYPE, VEHICLE_FILE);
//			}
//		}
//		fileService.editByType(String.valueOf(vehicleInfo.getId()), vehicleInfoVO.getDisposalFileList(), DISPOSAL_FILE);
//		fileService.editByType(String.valueOf(vehicleInfo.getId()), vehicleInfoVO.getDrivingLicenseFileList(), DRIVING_LICENSE_FILE);
//		fileService.editByType(String.valueOf(vehicleInfo.getId()), vehicleInfoVO.getFileList(), VEHICLE_FILE);
//
//		return saveOrUpdate(vehicleInfo);
//	}
//
//	@Override
//	public HashMap<String,Object> commit(String id) {
//		handleStatus(Long.valueOf(id), FormStatusConstant.FLOW, CarInfoStatus.AUDIT.getStatus(), "提交");
//		//将需要提交的流程变量返回，用于工作流侧
//		return new HashMap<String,Object>();
//	}
//
//	@Override
//	public Boolean finish(String id) {
//		/**
//		 * 设置审批人和审批时间
//		 */
//		VehicleInfo vehicleInfo = getById(id);
//		vehicleInfo.setApprovedUser(TokenUtil.getTokenUserId());
//		Date now = DateUtil.now();
//		vehicleInfo.setApprovedTime(now);
//		String code = formCodeService.getFilingCode(FormTypeConstant.FR_VEHICLE_INFO);
//		vehicleInfo.setApprovalCode(gzwProperties.getCodeStartName() + "车审业考（" + code.substring(0,4) + "）" + code.substring(code.length() - 3) + "号");
//		if (String.valueOf(FR_VEHICLE_UPDATE).equals(vehicleInfo.getFormType())){
//			if (vehicleInfo.getDisposalVehicleId() != null){
//				VehicleInfo disposalVehicleInfo = getById(vehicleInfo.getDisposalVehicleId());
//				if (StringUtil.isNotBlank(disposalVehicleInfo.getDisposalMethod())
//						&& disposalVehicleInfo.getDisposalDate() != null
//						&& disposalVehicleInfo.getDisposalPrice() != null){
//					updateCarStatus(vehicleInfo.getDisposalVehicleId(), CarInfoStatus.DISPOSAL.getStatus());
//				}else {
//					updateCarStatus(vehicleInfo.getDisposalVehicleId(), CarInfoStatus.PROPOSED_DISPOSAL.getStatus());
//				}
//			}
//		}
//		if (String.valueOf(FR_VEHICLE_TRANSFER).equals(vehicleInfo.getFormType())){
//			//划转
//			if (vehicleInfo.getTransferVehicleInfoId() != null){
//				updateCarStatus(vehicleInfo.getTransferVehicleInfoId(), CarInfoStatus.TRANSFER.getStatus());
//			}
//			vehicleInfo.setOldOrgId(vehicleInfo.getCompanyId());
//			vehicleInfo.setStatus(CarInfoStatus.USING.getStatus());
//			vehicleInfo.setCompanyId(vehicleInfo.getTransferOrgId());
//			vehicleInfo.setCreateCompanyId(vehicleInfo.getTransferOrgId());
//		}
//		updateById(vehicleInfo);
//		if (StringUtil.isBlank(vehicleInfo.getNumberPlate())){
//			//处置方式为 退租和淘汰
//			if (StringUtil.isNotBlank(vehicleInfo.getDisposalMethod())
//					&& vehicleInfo.getDisposalDate() != null
//					&& vehicleInfo.getDisposalPrice() != null){
//				return handleStatus(Long.valueOf(id), FormStatusConstant.FINISH, CarInfoStatus.DISPOSAL.getStatus(), "审批完成");
//			}
//			return handleStatus(Long.valueOf(id), FormStatusConstant.FINISH, CarInfoStatus.PROPOSED_DISPOSAL.getStatus(), "审批完成");
//		}else {
//			return handleStatus(Long.valueOf(id), FormStatusConstant.FINISH, CarInfoStatus.USING.getStatus(), "审批完成");
//		}
//	}
//
//	@Override
//	public Boolean reject(String id, int formState, String comment) {
//		return handleStatus(Long.valueOf(id), formState, CarInfoStatus.UNREVIEWED.getStatus(), comment);
//	}
//
//
//	@Override
//	public List<PageData> findByIds(List<String> formIds) {
//		LambdaQueryWrapper<VehicleInfo> queryWrapper = new LambdaQueryWrapper<>();
//		queryWrapper.in(VehicleInfo::getId, Func.toLongList(StringUtils.join(formIds, StringPool.COMMA)));
//		List<VehicleInfo> baseMainIndicators = list(queryWrapper);
//		List<VehicleInfoVO> vehicleInfoVOS = vehicleInfoWrapper.entityToVO(baseMainIndicators);
//		List<PageData> pageDataList = new ArrayList<>();
//		try{
//			if (CollectionUtil.isNotEmpty(vehicleInfoVOS)){
//				for (VehicleInfoVO vo : vehicleInfoVOS){
//					PageData pd = new PageData();
//					pd.put("id", vo.getId());
//					pd.put("UNITNAME", vo.getCompanyName());
//					pd.put("APPLICANTNAME", vo.getCreateUserName());
//					pd.put("applicantId", vo.getCreateUser());
//					pd.put("applyOrganizationId", vo.getCompanyId());
//					pd.put("formType", vo.getFormType());
//					pd.put("orgName", vo.getCompanyName());
//					if (String.valueOf(FR_VEHICLE_UPDATE).equals(vo.getFormType())){
//						VehicleInfo disposalVehicleInfo = getById(vo.getDisposalVehicleId());
//						pd.put("vehicleDisposal", disposalVehicleInfo.getDisposalMethod());
//					}
//					pageDataList.add(pd);
//				}
//			}
//
//			return pageDataList;
//		} catch (Exception e) {
//			log.error(ExceptionUtils.getFullStackTrace(e));
//		}
//		return pageDataList;
//	}
//
//	/**
//	 * FR_VEHICLE_INFO FR_VEHICLE_UPDATE
//	 * @return
//	 */
//	@Override
//	public List<Integer> getFormType() {
//		return Arrays.asList(FormTypeConstant.FR_VEHICLE_INFO, FR_VEHICLE_UPDATE, FR_VEHICLE_TRANSFER);
//	}
//
//
//	@Override
//	public void goBackToStash(String formId) {
//		Long id = Long.valueOf(formId);
//		VehicleInfo vehicleInfo = getById(id);
//		if (vehicleInfo.getStatus() == FormStatusConstant.FINISH){
//			vehicleInfo.setApprovedTime(null);
//			vehicleInfo.setApprovedUser(null);
//			if (String.valueOf(FR_VEHICLE_UPDATE).equals(vehicleInfo.getFormType())){
//				if (vehicleInfo.getDisposalVehicleId() != null){
//					updateCarStatus(vehicleInfo.getDisposalVehicleId(), CarInfoStatus.IN_DISPOSAL.getStatus());
//				}
//			}
//
//			if (String.valueOf(FR_VEHICLE_TRANSFER).equals(vehicleInfo.getFormType())){
//				//划转
//				if (vehicleInfo.getTransferVehicleInfoId() != null){
//					updateCarStatus(vehicleInfo.getTransferVehicleInfoId(), CarInfoStatus.IN_TRANSFER.getStatus());
//				}
//				vehicleInfo.setOldOrgId(null);
//				vehicleInfo.setOldCreateCompanyId(null);
//				vehicleInfo.setStatus(CarInfoStatus.IN_TRANSFER.getStatus());
//				vehicleInfo.setCompanyId(vehicleInfo.getOldOrgId());
//				vehicleInfo.setCreateCompanyId(vehicleInfo.getOldCreateCompanyId());
//			}
//			updateById(vehicleInfo);
//		}
//		handleStatus(Long.valueOf(formId), UNREVIEWED, CarInfoStatus.UNREVIEWED.getStatus(), null);
//	}
//
//	@Override
//	public VehicleInfoVO detail(VehicleInfo vehicleInfo) {
//		VehicleInfo detail = getOne(Condition.getQueryWrapper(vehicleInfo));
//		return setVO(detail);
//	}
//
//	/**
//	 * 流转单 所属单位处理
//	 * @param vehicleInfoVO
//	 */
//	@Override
//	public void changeTransferVO(VehicleInfoVO vehicleInfoVO){
//		if (String.valueOf(FR_VEHICLE_TRANSFER).equals(vehicleInfoVO.getFormType())
//				&& !vehicleInfoVO.getCompanyId().equals(vehicleInfoVO.getTransferOrgId())){
//			vehicleInfoVO.setCompanyId(vehicleInfoVO.getTransferOrgId());
//			vehicleInfoVO.setCompanyName(vehicleInfoVO.getTransferOrgName());
//		}
//	}
//
//	private VehicleInfoVO setVO(VehicleInfo detail){
//		VehicleInfoVO vehicleInfoVO = vehicleInfoWrapper.entityToVO(detail);
//		changeTransferVO(vehicleInfoVO);
//		if (String.valueOf(FR_VEHICLE_UPDATE).equals(vehicleInfoVO.getFormType())){
//			VehicleInfoVO disposalVehicleInfo = vehicleInfoWrapper.entityToVO(getById(detail.getDisposalVehicleId()));
//			vehicleInfoVO.setDisposalVehicleInfo(disposalVehicleInfo);
//			try {
//				List<PageData> list = fileDao.findParentId(String.valueOf(disposalVehicleInfo.getId()));
//				List<HashMap> drivingLicenseFileList = new ArrayList<>();
//				List<HashMap> disposalFileList = new ArrayList<>();
//				List<HashMap> fileList = new ArrayList<>();
//				if (CollectionUtil.isNotEmpty(list)){
//					for (PageData pageData : list){
//						fileService.setViewInfo(pageData);
//						if (DRIVING_LICENSE_FILE.equals(pageData.getString(FILE_TYPE))){
//							drivingLicenseFileList.add(pageData);
//						}else if (DISPOSAL_FILE.equals(pageData.getString(FILE_TYPE))){
//							disposalFileList.add(pageData);
//						}else if (VEHICLE_FILE.equals(pageData.getString(FILE_TYPE))){
//							fileList.add(pageData);
//						}
//					}
//				}
//				disposalVehicleInfo.setDrivingLicenseFileList(drivingLicenseFileList);
//				disposalVehicleInfo.setDisposalFileList(disposalFileList);
//				disposalVehicleInfo.setFileList(fileList);
//			}catch (Exception e){
//				log.error("附件获取失败");
//			}
//		}
//		try {
//			List<PageData> list = fileDao.findParentId(String.valueOf(detail.getId()));
//			List<HashMap> drivingLicenseFileList = new ArrayList<>();
//			List<HashMap> disposalFileList = new ArrayList<>();
//			List<HashMap> fileList = new ArrayList<>();
//			if (CollectionUtil.isNotEmpty(list)){
//				for (PageData pageData : list){
//					fileService.setViewInfo(pageData);
//					if (DRIVING_LICENSE_FILE.equals(pageData.getString(FILE_TYPE))){
//						drivingLicenseFileList.add(pageData);
//					}else if (DISPOSAL_FILE.equals(pageData.getString(FILE_TYPE))){
//						disposalFileList.add(pageData);
//					}else if (VEHICLE_FILE.equals(pageData.getString(FILE_TYPE))){
//						fileList.add(pageData);
//					}
//				}
//				vehicleInfoVO.setDrivingLicenseFileList(drivingLicenseFileList);
//				vehicleInfoVO.setDisposalFileList(disposalFileList);
//				vehicleInfoVO.setFileList(fileList);
//			}
//		}catch (Exception e){
//			log.error("附件获取失败");
//		}
//
//		return vehicleInfoVO;
//	}
//
//	@Override
//	public VehicleInfoVO getDetailVO(Object id) {
//		return setVO(getById(Long.valueOf(String.valueOf(id))));
//	}
//
//	@Override
//	public String ythSubmitBatch(String data) {
//		YthResult ythResult = new YthResult();
//		//成功的id集合
//		List<String> successIds = new ArrayList<>();
//		//失败的id集合
//		List<String> failIds = new ArrayList<>();
//		//失败的原因
//		List<String> failReasons = new ArrayList<>();
//		//将json字符串转换成list
//		List<VehicleInfoVO> dataList = JSON.parseArray(data, VehicleInfoVO.class);
//		if (CollectionUtil.isEmpty(dataList)){
//			failReasons.add("数据为空");
//			ythResult.setFailReason(StringUtils.join(failReasons, StringPool.COMMA));
//			return JSON.toJSONString(ythResult);
//		}
//		List<VehicleInfo> vehicleInfoList = list();
//		List<String> cantSubmitList = vehicleInfoList.stream().filter(vehicleInfo -> vehicleInfo.getCarStatus() == CarInfoStatus.UNREVIEWED.getStatus()
//				|| vehicleInfo.getCarStatus() == CarInfoStatus.AUDIT.getStatus()
//				|| vehicleInfo.getCarStatus() == CarInfoStatus.USING.getStatus()).map(VehicleInfo::getNumberPlate).collect(Collectors.toList());
//		String vehicleInfoType = String.valueOf(FormTypeConstant.FR_VEHICLE_INFO);
//		String vehicleUpdateType = String.valueOf(FormTypeConstant.FR_VEHICLE_UPDATE);
//
//		List<VehicleInfo> oldList = list(Wrappers.<VehicleInfo>lambdaQuery()
//				.in(VehicleInfo::getStatus, Stream.of(STASH, UNREVIEWED, REJECT).collect(Collectors.toList()))
//				.eq(VehicleInfo::getDataSource, YthConstant.DATA_NINGBO));
//		Map<String, VehicleInfo> oldMap = oldList.stream().collect(Collectors.toMap(VehicleInfo::getDataSourceId, Function.identity()));
//		List<Org> orgList = orgService.getYthOrgList();
//		Map<String, Org> dataSourceIdOrgMap = orgList.stream().collect(Collectors.toMap(Org::getDataSourceId, Function.identity()));
//
//		List<VehicleInfo> canUpdateList = list(Wrappers.<VehicleInfo>lambdaQuery()
//				.eq(VehicleInfo::getCarStatus, CarInfoStatus.USING.getStatus())
//				.eq(VehicleInfo::getStatus, FINISH)
//				.eq(VehicleInfo::getDataSource, YthConstant.DATA_NINGBO));
//		Map<String, VehicleInfo> canUpdateMap = canUpdateList.stream().collect(Collectors.toMap(VehicleInfo::getDataSourceId, Function.identity()));
//
//		List<VehicleInfo> transferDataList = list(Wrappers.<VehicleInfo>lambdaQuery()
//				.eq(VehicleInfo::getStatus, FINISH)
//				.eq(VehicleInfo::getDataSource, YthConstant.DATA_NINGBO));
//		Map<String, VehicleInfo> transferDataMap = transferDataList.stream().collect(Collectors.toMap(VehicleInfo::getDataSourceId, Function.identity()));
//		List<VehicleInfo> submitList = new ArrayList<>();
//		Date now = DateUtil.now();
//		for (VehicleInfoVO vehicleInfoVO : dataList){
//			if (!(vehicleInfoType.equals(vehicleInfoVO.getFormType()) || vehicleUpdateType.equals(vehicleInfoVO.getFormType()))){
//				failIds.add(vehicleInfoVO.getDataSourceId());
//				failReasons.add(vehicleInfoVO.getDataSourceId() + "formType类型错误");
//				continue;
//			}
//			if (vehicleInfoType.equals(vehicleInfoVO.getFormType())){
//				if (cantSubmitList.contains(vehicleInfoVO.getNumberPlate()) && !oldMap.containsKey(vehicleInfoVO.getDataSourceId())){
//					failIds.add(vehicleInfoVO.getDataSourceId());
//					failReasons.add(vehicleInfoVO.getDataSourceId() + "车辆不可提交");
//					continue;
//				}
//			}
//
//			VehicleInfo vehicleInfo = vehicleInfoWrapper.voToEntity(vehicleInfoVO);
//			VehicleInfo oldInfo = null;
//			if (oldMap.containsKey(vehicleInfoVO.getDataSourceId())){
//				oldInfo = oldMap.get(vehicleInfoVO.getDataSourceId());
//				vehicleInfo.setId(oldInfo.getId());
//				vehicleInfo.setUpdateTime(now);
//			}else {
//				vehicleInfo.setCreateTime(now);
//			}
//			if (vehicleUpdateType.equals(vehicleInfoVO.getFormType())){
//				if (vehicleInfoVO.getDisposalVehicleInfo() == null){
//					failIds.add(vehicleInfoVO.getDataSourceId());
//					failReasons.add(vehicleInfoVO.getDataSourceId() + "处置车辆信息为空");
//					continue;
//				}
//				if (oldInfo == null && !canUpdateMap.containsKey(vehicleInfoVO.getDisposalVehicleInfo().getDataSourceId())){
//					failIds.add(vehicleInfoVO.getDataSourceId());
//					failReasons.add(vehicleInfoVO.getDisposalVehicleInfo().getDataSourceId() + "处置车辆不存在");
//					continue;
//				}
//				VehicleInfo disposalVehicleInfo = transferDataMap.get(vehicleInfoVO.getDisposalVehicleInfo().getDataSourceId());
//				if (!(oldInfo != null && oldInfo.getDisposalVehicleId().equals(disposalVehicleInfo.getId())) &&
//						disposalVehicleInfo.getCarStatus() != CarInfoStatus.USING.getStatus()){
//					failIds.add(vehicleInfoVO.getDataSourceId());
//					failReasons.add(vehicleInfoVO.getDisposalVehicleInfo().getDataSourceId() + "处置车辆不可处置");
//					continue;
//				}
//
//				vehicleInfo.setDisposalVehicleId(disposalVehicleInfo.getId());
//				disposalVehicleInfo.setDisposalDate(vehicleInfoVO.getDisposalVehicleInfo().getDisposalDate());
//				disposalVehicleInfo.setDisposalPrice(vehicleInfoVO.getDisposalVehicleInfo().getDisposalPrice());
//				disposalVehicleInfo.setDisposalMethod(vehicleInfoVO.getDisposalVehicleInfo().getDisposalMethod());
//				disposalVehicleInfo.setCarStatus(CarInfoStatus.IN_DISPOSAL.getStatus());
//				submitList.add(disposalVehicleInfo);
//			}
//			successIds.add(vehicleInfo.getDataSourceId());
//			vehicleInfo.setDataSource(YthConstant.DATA_NINGBO);
//			vehicleInfo.setStatus(UNREVIEWED);
//			vehicleInfo.setCarStatus(CarInfoStatus.UNREVIEWED.getStatus());
//			vehicleInfo.setIsDeleted(0);
//			if (StringUtil.isNotBlank(vehicleInfo.getFillingUnitId()) && dataSourceIdOrgMap.containsKey(vehicleInfo.getFillingUnitId())){
//				vehicleInfo.setFillingUnitId(dataSourceIdOrgMap.get(vehicleInfo.getFillingUnitId()).getId());
//				vehicleInfo.setCreateCompanyId(vehicleInfo.getFillingUnitId());
//			}
//			if (StringUtil.isNotBlank(vehicleInfo.getCompanyId()) && dataSourceIdOrgMap.containsKey(vehicleInfo.getCompanyId())){
//				vehicleInfo.setCompanyId(dataSourceIdOrgMap.get(vehicleInfo.getCompanyId()).getId());
//			}
//			saveOrUpdate(vehicleInfo);
//			fileService.upYthFile(vehicleInfoVO.getDrivingLicenseFileIds(), vehicleInfo.getId() + "", DRIVING_LICENSE_FILE);
//			fileService.upYthFile(vehicleInfoVO.getDisposalFileIds(), vehicleInfo.getId() + "", DISPOSAL_FILE);
//			fileService.upYthFile(vehicleInfoVO.getFileIds(), vehicleInfo.getId() + "", VEHICLE_FILE);
//		}
//
//		ythResult.setSuccessIds(successIds);
//		ythResult.setFailIds(failIds);
//		ythResult.setFailReason(StringUtils.join(failReasons, StringPool.COMMA));
//		//ythResult转换成json字符串
//		return JSON.toJSONString(ythResult);
//	}
//
//	@Override
//	public VehicleInfoVO getInitData(String companyId) {
//		VehicleInfoVO vehicleInfoVO = new VehicleInfoVO();
//		vehicleInfoVO.setCarNumber(count(Wrappers.<VehicleInfo>lambdaQuery()
//				.eq(VehicleInfo::getCompanyId, companyId)
//				.eq(VehicleInfo::getStatus, FINISH)
//				.in(VehicleInfo::getCarStatus,
//						Stream.of(CarInfoStatus.USING.getStatus(), CarInfoStatus.IN_DISPOSAL.getStatus()).collect(Collectors.toList()))));
//		IndicatorsValueDTO indicatorsValueDTO = new IndicatorsValueDTO();
//		indicatorsValueDTO.setCode(Y87);
//		indicatorsValueDTO.setOrgId(companyId);
//		indicatorsValueDTO.setYear(DateUtil.format(DateUtil.now(), DateUtil.PATTERN_YEAR));
//		indicatorsValueDTO.setMonth("00");
//		List<IndicatorsValueVO> indicatorsValueVOS = indicatorsValueMapper.querySingleValueByCode(indicatorsValueDTO);
//		if (CollectionUtil.isNotEmpty(indicatorsValueVOS)){
//			vehicleInfoVO.setBudgetControlIndex(indicatorsValueVOS.get(0).getValue());
//			vehicleInfoVO.setIsChangeBudgetControlIndex(0);
//		}
//		return vehicleInfoVO;
//	}
//
//	/**
//	 * 统一处理状态机事件方法
//	 * @param id 主键
//	 * @param updateStatus 更新状态
//	 * @param comment
//	 * @return boolean
//	 */
//	private Boolean handleStatus(Long id, int updateStatus, int carInfoStatus, String comment) {
//		try {
//			VehicleInfo vehicleInfo = getById(id);
//			vehicleInfo.setStatus(updateStatus);
//			vehicleInfo.setCarStatus(carInfoStatus);
//			if ("提交".equals(comment)){
//				vehicleInfo.setSubmitTime(DateUtil.now());
//			}
//			if (YthConstant.DATA_NINGBO.equals(vehicleInfo.getDataSource())){
//				if (updateStatus == FormStatusConstant.FINISH || updateStatus == FormStatusConstant.REJECT){
//					ApprovalMessage approvalMessage = new ApprovalMessage();
//					approvalMessage.setDataSourceId(vehicleInfo.getDataSourceId());
//					approvalMessage.setOpinion(comment);
//					approvalMessage.setIsApprove(updateStatus == FormStatusConstant.FINISH ? 2 : 1);
//					approvalMessage.setIsSend(1);
//					approvalMessage.setFilingCode(vehicleInfo.getApprovalCode());
//					approvalMessage.setDataSourceType(YthConstant.DATA_NINGBO);
//					approvalMessage.setFilingUserName(UserCache.userIdToName(TokenUtil.getTokenUserId()));
//					approvalMessage.setFormType(Integer.valueOf(vehicleInfo.getFormType()));
//					approvalMessage.setFilingCode(vehicleInfo.getApprovalCode());
//					approvalMessageService.save(approvalMessage);
//				}
//			}
//			updateById(vehicleInfo);
//			return true;
//		} catch (Exception e) {
//			log.error(ExceptionUtils.getFullStackTrace(e));
//			return false;
//		}
//	}
//
//	private void updateCarStatus(Long id, int carStatus){
//		update(Wrappers.<VehicleInfo>lambdaUpdate().eq(VehicleInfo::getId, id).set(VehicleInfo::getCarStatus, carStatus));
//	}
//
//	@Override
//	public File buildword(Long id, HttpServletResponse response) {
//		VehicleInfo vehicleInfo = getById(id);
//		VehicleInfoVO bean = vehicleInfoWrapper.entityToVO(vehicleInfo);
//		VehicleInfo old = getById(bean.getDisposalVehicleId());
//		VehicleInfoVO oldBean = vehicleInfoWrapper.entityToVO(old);
//		File file = null;
//		try {
//			if (bean != null) {
//				Map<String, Object> data = new HashMap<>(9);
//				data.put("approvalCode", bean.getApprovalCode());
//				data.put("fillingUnitId", bean.getFillingUnitName());
//				data.put("contactPerson", bean.getContactPerson());
//				data.put("telephone", bean.getTelephone());
//				data.put("useReason", bean.getUseReason());
//				data.put("budgetControlIndex", bean.getBudgetControlIndex());
//				data.put("carNumber", bean.getCarNumber());
//				data.put("serialNumber", 1);
//				data.put("carModelId", bean.getCarModelName());
//				data.put("bareCarPrice", bean.getBareCarPrice());
//				data.put("count", 1);
//				if(Optional.ofNullable(oldBean).isPresent()){
//					data.put("disposalVehicleNumberPlate", oldBean.getNumberPlate());
//					data.put("disposalMethod", oldBean.getDisposalMethodName());
//				}
//
//
//
//				String realPath = environment.getProperty("doc.path")  + id + ".doc";
//				file = WordUtil.generateWord(data, realPath , "宁波市属国有企业生产经营用车购置审批表.doc","vehicleInfo.ftl");
//				String fileName = new String(file.getName().getBytes("GB2312"), "ISO_8859_1");
//				response.setHeader("Content-Disposition", "attachment;fileName=" + fileName);
//				InputStream inputStream = new FileInputStream(file);
//				// 激活下载操作
//				OutputStream os = response.getOutputStream();
//				// 循环写入输出流
//				byte[] b = new byte[2048];
//				int length;
//				while ((length = inputStream.read(b)) > 0) {
//					os.write(b, 0, length);
//				}
//				// 这里主要关闭。
//				os.close();
//				inputStream.close();
//			}
//
//		} catch (Exception e) {
//			log.error(ExceptionUtils.getFullStackTrace(e));
//		}
//		return file;
//	}
//
//	@Override
//	public void uploadFile(MultipartFile multipartFile){
//		try {
//			byte[] bytes = IOUtils.toByteArray(multipartFile.getInputStream());
//			InputStream inputStream = new ByteArrayInputStream(bytes);
//			List<Object> vehicleInfos = new ArrayList<>();
//			EasyExcel.read(inputStream).build()
//					.read(EasyExcel.readSheet(1).headRowNumber(1).head(VehicleInfoExcelBean.class)
//							.registerReadListener(new PageReadListener<>(list -> vehicleInfos.addAll(list))).build());
//			ImportExcelUtil.filterEmpty(vehicleInfos);
//			List<VehicleInfo> list = getList(vehicleInfos);
//			if (CollectionUtil.isNotEmpty(list)){
//				list.forEach(this::saveOrUpdate);
//			}
//		} catch (IOException e) {
//			e.printStackTrace();
//		} catch (IllegalAccessException e) {
//			e.printStackTrace();
//		}
//	}
//
//	@Override
//	public VehicleInfo transfer(VehicleInfoVO vehicleInfoVO) {
//		if (vehicleInfoVO.getTransferVehicleInfoId() == null){
//			throw new MyRuntimeException("划转车辆id为空！");
//		}
//		VehicleInfo oldInfo = getById(vehicleInfoVO.getTransferVehicleInfoId());
//		if (oldInfo == null){
//			throw new MyRuntimeException("划转车辆不存在！");
//		}
//		if (vehicleInfoVO.getId() == null && oldInfo.getCarStatus() != CarInfoStatus.USING.getStatus()){
//			throw new MyRuntimeException("该车辆不能进行划转！");
//		}
//		if (vehicleInfoVO.getId() != null){
//			//防止修改非流转车辆数据
//			VehicleInfo tempInfo = getById(vehicleInfoVO.getId());
//			if (tempInfo == null || !String.valueOf(FR_VEHICLE_TRANSFER).equals(tempInfo.getFormType())){
//				vehicleInfoVO.setId(null);
//			}
//		}
//
//		VehicleInfo vehicleInfo = vehicleInfoWrapper.voToEntity(vehicleInfoVO);
//		vehicleInfo.setCarStatus(CarInfoStatus.IN_TRANSFER.getStatus());
//		boolean fileFlag = true;
//		if (vehicleInfoVO.getId() != null){
//			fileFlag = false;
//		}
//		vehicleInfo.setIsShow(1);
//		vehicleInfo.setFormType(String.valueOf(FR_VEHICLE_TRANSFER));
//		vehicleInfo.setTransferOrgId(vehicleInfoVO.getCompanyId());
//		vehicleInfo.setCompanyId(oldInfo.getCompanyId());
//		saveOrUpdate(vehicleInfo);
//		if (CollectionUtil.isNotEmpty(vehicleInfoVO.getDrivingLicenseFileList())){
//			for (Map map : vehicleInfoVO.getDrivingLicenseFileList()){
//				if (fileFlag && map.containsKey("id")){
//					map.remove("id");
//				}
//				map.put(FILE_TYPE, DRIVING_LICENSE_FILE);
//			}
//		}
//		if (CollectionUtil.isNotEmpty(vehicleInfoVO.getFileList())){
//			for (Map map : vehicleInfoVO.getFileList()){
//				if (fileFlag && map.containsKey("id")){
//					map.remove("id");
//				}
//				map.put(FILE_TYPE, VEHICLE_FILE);
//			}
//		}
//		if (fileFlag){
//			fileService.saveAll(String.valueOf(vehicleInfo.getId()), vehicleInfoVO.getDrivingLicenseFileList());
//			fileService.saveAll(String.valueOf(vehicleInfo.getId()), vehicleInfoVO.getFileList());
//		}else {
//			fileService.editByType(String.valueOf(vehicleInfo.getId()), vehicleInfoVO.getDrivingLicenseFileList(), DRIVING_LICENSE_FILE);
//			fileService.editByType(String.valueOf(vehicleInfo.getId()), vehicleInfoVO.getFileList(), VEHICLE_FILE);
//		}
//
//		oldInfo.setIsShow(0);
//		oldInfo.setCarStatus(CarInfoStatus.IN_TRANSFER.getStatus());
//		updateById(oldInfo);
//		return vehicleInfo;
//	}
//
//	private List<VehicleInfo> getList(List<Object> vehicleInfos){
//		List<VehicleInfo> vehicleInfoList = new ArrayList<>();
//
//		for (Object object : vehicleInfos) {
//			VehicleInfoExcelBean excelBean = (VehicleInfoExcelBean) object;
////			VehicleInfoVO vehicleInfoVO = new VehicleInfoVO();
//			VehicleInfo vehicleInfo = new VehicleInfo();
//			vehicleInfo.setBudgetControlIndex(BigDecimalUtil.toBigdecimal(excelBean.getBudgetControlIndex()));
//			vehicleInfo.setCarNumber(excelBean.getCarNumber());
//			Org org = orgService.getOne(new LambdaQueryWrapper<Org>()
//							.ne(Org::getIsDel, "1")
//							.eq(Org::getForGzw, "1")
//					.eq(Org::getName, excelBean.getFillingUnit()));
//			if(Optional.ofNullable(org).isPresent()){
//				vehicleInfo.setFillingUnitId(org.getId());
//			}
//			vehicleInfo.setNumberPlate(excelBean.getNumberPlate());
//			vehicleInfo.setBrand(excelBean.getBrand());
//			vehicleInfo.setBareCarPrice(new BigDecimal(excelBean.getBareCarPrice()));
//			if (StringUtil.isNotBlank(excelBean.getPurchaseDate())){
//				vehicleInfo.setPurchaseDate(DateUtil.parse(excelBean.getPurchaseDate(),DateUtil.PATTERN_MONTH));
//			}
//			Org org1 = orgService.getOne(new LambdaQueryWrapper<Org>()
//							.eq(Org::getForGzw, "1")
//					.eq(Org::getIsDel, "0")
//					.eq(Org::getName, excelBean.getCompany()));
//			if(Optional.ofNullable(org1).isPresent()){
//				vehicleInfo.setCompanyId(org1.getId());
//			}
//			vehicleInfo.setDynamicType(excelBean.getDynamicType());
//			vehicleInfo.setExhaustVolume(BigDecimalUtil.toBigdecimal(excelBean.getExhaustVolume()));
//			vehicleInfo.setCarModelId(excelBean.getCarModel());
//			vehicleInfo.setApplicationId(excelBean.getApplicationId());
//			vehicleInfo.setApprovalCode(excelBean.getApprovalCode());
//			vehicleInfo.setCreateCompanyId(vehicleInfo.getFillingUnitId());
//			if(StringUtil.isNotBlank(excelBean.getUseReason())){
//				vehicleInfo.setUseReason(excelBean.getUseReason());
//			}
//			if(StringUtil.isNotBlank(excelBean.getContactPerson())){
//				vehicleInfo.setContactPerson(excelBean.getContactPerson());
//			}
//			if(StringUtil.isNotBlank(excelBean.getTelephone())){
//				vehicleInfo.setTelephone(excelBean.getTelephone());
//			}
//			if(StringUtil.isNotBlank(excelBean.getRemark())){
//				vehicleInfo.setRemark(excelBean.getRemark());
//			}
//			vehicleInfo.setFormType(String.valueOf(FormTypeConstant.FR_VEHICLE_INFO));
//			vehicleInfo.setCarStatus(CarInfoStatus.USING.getStatus());
//			vehicleInfo.setStatus(FINISH);
//			vehicleInfoList.add(vehicleInfo);
//		}
//
//		return vehicleInfoList;
//	}
//
//}
